
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

package com.hlkj.pay.app.merchant.ext;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.framework.extension.ExtensionPointI;
import com.hlkj.pay.app.merchant.ext.dto.access.*;
import com.hlkj.pay.dto.merchant.AccessChannelParamsDto;
import com.hlkj.pay.dto.merchant.MerchantAccessDto;
import com.hlkj.pay.infrastructure.model.pay.ProviderChannelConfigDO;
import com.hlkj.pay.vo.order.resp.MerchantProductQueryResp;

/**
 * 通道商户进件
 * 
 * @author HlpayTeam
 * @date 2024/09/12 11:39
 */
public interface ChannelMerchantAccessExtPt extends ExtensionPointI {

    int OK = 200;
    /**
     * 商户进件 channelMerchantAccessCommonContext
     *
     * @param channelMerchantAccessCommonContext
     * @return
     */
    void channelConfigCheck(ChannelMerchantAccessCommonContext channelMerchantAccessCommonContext);
    /**
     * 商户进件 channelMerchantAccessContext
     * 
     * @param channelMerchantAccessContext
     * @return
     */
    void merchantAccess(ChannelMerchantAccessContext channelMerchantAccessContext);

    /**
     * requestUrl
     *
     * @param merchantAccessInfoDO
     * @return
     */
    String requestUrl(MerchantAccessDto merchantAccessDto);
    /**
     * requestUrl
     *
     * @param accessChannelParamsDto
     * @return
     */
    String channelParams(AccessChannelParamsDto accessChannelParamsDto);

    /**
     * 商户进件 channelMerchantAccessContext
     * 
     * @param channelMerchantAccessContext
     * @return
     */
    void merchantAccessQuery(ChannelMerchantAccessQueryContext channelMerchantAccessContext);

    /**
     * 商户业务签约 channelMerchantBusinessContext
     * 
     * @param channelMerchantAccessSignContext
     * @return
     */
    void merchantSign(ChannelMerchantAccessSignContext channelMerchantAccessSignContext);
    /**
     * 商户业务签约 channelMerchantBusinessContext
     *
     * @param channelMerchantAccessSignContext
     * @return
     */
    void merchantSignQuery(ChannelMerchantAccessSignContext channelMerchantAccessSignContext);

    /**
     * 商户业务开通 channelMerchantBusinessContext
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void merchantBusinessOpen(ChannelMerchantBusinessContext channelMerchantBusinessContext);

    /**
     * 微信参数配置
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void wechatConfigInit(ChannelMerchantBusinessContext channelMerchantBusinessContext);
    /**
     * 微信参数配置
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void wechatConfigAdd(ChannelMerchantBusinessContext channelMerchantBusinessContext);
    /**
     * 微信参数配置
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void wechatConfigQuery(ChannelMerchantAccessAuthQueryContext channelMerchantBusinessContext);
    /**
     * 微信认证配置
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void wechatAuthConfig(ChannelMerchantBusinessContext channelMerchantBusinessContext);
    /**
     * 认证查询是否需要报备信息
     *
     * @param
     * @return
     */
    boolean authConfigQueryType();
    /**
     * 微信认证查询
     *
     * @param channelMerchantAccessAuthQueryContext
     * @return
     */
    void wechatAuthQuery(ChannelMerchantAccessAuthQueryContext channelMerchantAccessAuthQueryContext);

    /**
     * 支付宝认证
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void alipayAuthConfig(ChannelMerchantBusinessContext channelMerchantBusinessContext);
    /**
     * 支付宝认证查询
     *
     * @param channelMerchantBusinessContext
     * @return
     */
    void alipayAuthQuery(ChannelMerchantAccessAuthQueryContext channelMerchantBusinessContext);

    /**
     * 商户进件结果回调参数解析
     *
     * @param request
     * @return
     */
    MerchantAccessCallBackDto accessCallBackParamsParse(HttpServletRequest request, ProviderChannelConfigDO providerChannelConfigDO);

    /**
     * 进件
     *
     * @param callBackBody
     * @return
     */
    CommonResult<String> accessCallbackParse(String callBackBody, List<ProviderChannelConfigDO> channelConfigDOList);

    /**
     * 商户业务开通结果回调参数解析
     *
     * @param callBackBody
     * @return
     */
    MerchantBusinessCallBackDto businessCallBackParamsParse(String callBackBody,ProviderChannelConfigDO providerChannelConfigDO);
    /**
     * 商户业务开通结果回调参数解析
     *
     * @param callBackBody
     * @return
     */
    boolean verify(String callBackBody, ProviderChannelConfigDO providerChannelConfigDO);

    /**
     * 返回信息
     *
     * @param commonResult
     * @return
     */
    String callBackResponse(CommonResult commonResult);

    /**
     *
     * @param channelMerchantTermContext
     */
    void termAdd(ChannelMerchantTermContext channelMerchantTermContext);

    /**
     *
     * @param channelMerchantBusinessContext
     */
    void reloadMerchantAuth(ChannelMerchantBusinessContext channelMerchantBusinessContext);

    /**
     *
     * @param channelMerchantBusinessContext
     */
    void channelSplit(ChannelMerchantBusinessContext channelMerchantBusinessContext);


    void productUpdate(ChannelMerchantBusinessContext channelMerchantBusinessContext);


    Integer queryMerAuthStatus(ChannelMerchantAccessAuthQueryContext channelMerchantAccessAuthQueryContext);

    MerchantProductQueryResp productQuery(ChannelMerchantBusinessContext channelMerchantBusinessContext);

    /**
     *
     * @param request
     * @param providerChannelConfigDO
     * @return
     */
    MerchantChannelSplitCallBackDto easySplitCallBackParamsParse(HttpServletRequest request, ProviderChannelConfigDO providerChannelConfigDO);
}
